package com.wanxi.app.controller.api;

import com.wanxi.app.service.user.UserService;
import com.wanxi.user.domain.dto.UserInfoDto;
import com.wanxi.user.domain.entity.UserInfo;
import com.wanxi.user.domain.result.UserResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author:wgy
 * @Data：2022/1/13 17:14
 */
@RestController
@RequestMapping
@Api(tags = "用户信息")
public class UserApi {

    @Resource
    private UserService userService;

    /**
     * 查找用户信息
     *
     * @param userId
     * @return
     */
    @ApiOperation(value = "用户查看个人信息")
    @GetMapping("findById")
    public UserResult<UserInfo> findById(@RequestParam("userId") long userId) {
        return userService.findById(userId);
    }

    /**
     * 修改用户信息
     *
     * @param userInfoDto
     * @return
     */
    @ApiOperation(value = "用户修改个人信息")
    @PostMapping("updateById")
    public UserResult<Boolean> updateById(UserInfoDto userInfoDto) {
        return userService.updateById(userInfoDto);
    }
}
